$(document).ready(function(){  
	$("#autoPost").validate({
		onkeyup: false, 
		invalidHandler: function(e, validator) {},
		rules: {
			pwd: {required: true,minlength: 6}
		},
 		errorPlacement: function(error, element) {
			$("#"+element.attr("name")+"Info").html(error.attr("class","zf-point"));
 		},
 		success: function(label) {
			label.html("&nbsp;").addClass("mima");
		},
 		messages:{
 			pwd: {required:"请填写密码",minlength:"密码长度至少6位"}
 		},
		submitHandler:function(form){form.submit();}
	});
	
	$("#umoneyPayForm").validate({
		onkeyup: false, 
		invalidHandler: function(e, validator) {
			
		},
		rules: {
			umoneyPwd: {required:true,minlength:6}
		},
 		errorPlacement: function(error, element) {
			$("#"+element.attr("name")+"Info").html(error.attr("class","zf-point"));
		},
 		success: function(label) {
			label.html("&nbsp;").addClass("mima");
		},
 		messages:{
 			umoneyPwd: {required:"请填写密码",minlength:"密码长度至少6位"}
		},
		submitHandler:function(form){
 			var money = $("#payAmt").val();
 			if(money>0){
 				$("#umoneyPayFloat").show();
 				$("#diagPopAlpha").show();
 				form.submit();
 			}else{
 				alert('0元课程，请走余额支付。');
 				$("#umoneyPwd").focus();
 			}
 		}
	});
	$("#payFromBank").validate({
		onkeyup: true, 
		invalidHandler: function(e, validator) {},
		rules: {
			pwd2: {required:true,minlength:6}
		},
 		errorPlacement: function(error, element) {
			$("#"+element.attr("name")+"Info").html(error.attr("class","zf-point"));
		},
 		success: function(label) {
			label.html("&nbsp;").addClass("mima");
		},
 		messages:{
			pwd2: {required:"请填写密码",minlength:"密码长度至少6位"}
		},
		submitHandler:function(form){
 			var money = $("#p3_Amt").val();
 			if(money>0){
 				showFloat();form.submit();
 			}else{
 				alert('0元课程，请直接输入支付密码完成支付。');
 				$("#pwd").focus();
 			}
 		}
	});
	//余额付款
	$("#yefk").click(function(){
		if(document.getElementById("yefk").checked){ //使用
			$("#pwd2").val("");
			$("#yefkDiv").addClass("mb20");
			$("#yefkPwd").show();
		}else{ //不使用余额付款
			$("#pwd2").val("123456789");//仅仅为了验证
			$("#yefkPwd").hide();
			$("#yefkDiv").removeClass("mb20");
		}
	});
	
	//余额付款
	$("#umoneyPwd").click(function(){
		document.getElementById("yefk").checked=false;
		$("#yefkPwd").hide();
		$("#yefkDiv").removeClass("mb20");
	});
	
	
});
